import { request } from '@/utils'

interface RouteData {
  id?: number
  name?: string
  points?: any[]
  [key: string]: any
}

interface ChargeData {
  id?: number
  name?: string
  point?: any
  [key: string]: any
}

interface QueryParams {
  pageNum?: number
  pageSize?: number
  [key: string]: any
}

export const inspectionRoute = {
  create(data: RouteData) {
    return request({
      url: '/robot-inspection-route/v1/create',
      method: 'post',
      data
    })
  },
  read(params: QueryParams) {
    return request({
      url: '/robot-inspection-route/v1/list',
      method: 'get',
      params
    })
  },
  update(data: RouteData) {
    return request({
      url: '/robot-inspection-route/v1/update',
      method: 'put',
      data
    })
  },
  delete(id: number) {
    return request({
      url: '/robot-inspection-route/v1/delete/' + id,
      method: 'delete'
    })
  }
}

export const inspectionCharge = {
  create(data: ChargeData) {
    return request({
      url: '/robot-disinfect-charge-point/v1/create',
      method: 'post',
      data
    })
  },
  read(params: QueryParams) {
    return request({
      url: '/robot-disinfect-charge-point/v1/list',
      method: 'get',
      params
    })
  },
  update(data: ChargeData) {
    return request({
      url: '/robot-disinfect-charge-point/v1/update',
      method: 'put',
      data
    })
  },
  delete(id: number) {
    return request({
      url: '/robot-disinfect-charge-point/v1/delete/' + id,
      method: 'delete'
    })
  }
}
